package com.weigj.controller;

import java.util.List;

import com.jfinal.core.Controller;
import com.weigj.model.Dept;

public class DeptControll extends Controller {
	
	
	
	public void	queryDept(){
		String cityName=getPara("cityName");
		System.out.println(cityName);
		List<Dept> deptList=Dept.deptDao.queryDeptByCityName(cityName);
		setAttr("deptList", deptList);
		setAttr("cityName", cityName);
		render("/yd_site.jsp");
	}
	
	public void queryDeptBytname(){
		String tName=getPara("dept.tname");
		List<Dept> deptList=Dept.deptDao.queryDeptByTname(tName);
		System.out.println(deptList.size());
		renderJson("deptList",deptList);
	}
	
	public void backInex(){
		Long id=getParaToLong("id");
		String deptName=getPara("deptName");
		setAttr("id", id);
		setAttr("deptName", deptName);
		render("/yd_index.jsp");
	}
	
	public void queryDeptJson(){
		String cityName=getPara("cityName");
		List<Dept> deptList=Dept.deptDao.queryDeptByCityName(cityName);
		renderJson("deptList", deptList);
	}
}
